package com.tan.androidtest.application;

import android.app.Application;
import android.os.Handler;
import android.os.Message;
import android.util.Log;


/**
 * 测试Application中实现心跳
 */

public class MyApplication extends Application {

    private static Handler mHandler;

    @Override
    public void onCreate() {
        super.onCreate();
        if (mHandler == null) {
            mHandler = new MyHandler();
        }
        mHandler.sendEmptyMessageDelayed(100, 3000);
    }

    static class MyHandler extends Handler {

        @Override
        public void handleMessage(Message msg) {
            Log.i("==--", "下一次来了");
            mHandler.sendEmptyMessageDelayed(100, 3000);
        }
    }
}
